<html>
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="style.css" />
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeRDark.css" rel="stylesheet" type="text/css" />
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script>
<script type="text/javascript">
SyntaxHighlighter.all();
</script>
</head>
<body>
<div class="header" style="border-top: 1px solid #C9D7F1;margin: 9px;margin-top: 24px;padding-top: 5px;margin-bottom: 10px;">
    <a href="http://code.google.com/p/yuki/"><img src="http://code.google.com/p/yuki/logo?cct=1297980533" /></a>
    <div style="display: inline-block;padding-left: 11px;">
        <div class="project-name">
            <a style="text-decoration: none;color: #666;font-family: arial, sans-serif;font-size: 39px;" href="http://code.google.com/p/yuki/">yuki</a>
        </div>
        <div class="project-summary">
            <a href="http://code.google.com/p/yuki/" style="text-decoration: none;color: #444;font-family: arial, sans-serif;font-size: 13px;">Yuki PHP Framework</a>
        </div>
    </div>
</div>
<table width="100%"><tr><td width="200" valign="top">
<div class="sidebar"><ul><li class="package">yuki<ul><li class="subpackage">autoload<ul><li class="class"><a href="yAutoloader.html">yAutoloader</a></li><li class="class"><a href="yCoreAutoloader.html">yCoreAutoloader</a></li></ul></li><li class="subpackage">output<ul><li class="class"><a href="yBuffer.html">yBuffer</a></li></ul></li><li class="subpackage">callable<ul><li class="class"><a href="yCallable.html">yCallable</a></li></ul></li><li class="subpackage">debug<ul><li class="class"><a href="yDebugger.html">yDebugger</a></li></ul></li><li class="subpackage">geometry<ul><li class="class"><a href="yDimension.html">yDimension</a></li><li class="class"><a href="yPoint.html">yPoint</a></li><li class="class"><a href="yRectangle.html">yRectangle</a></li></ul></li><li class="subpackage">doc<ul><li class="class"><a href="yDocBlock.html">yDocBlock</a></li><li class="class"><a href="yDocumentor.html">yDocumentor</a></li><li class="class"><a href="yMethodDocumentor.html">yMethodDocumentor</a></li></ul></li><li class="subpackage">exception<ul><li class="class"><a href="yException.html">yException</a></li><li class="class"><a href="yExceptionHandler.html">yExceptionHandler</a></li></ul></li><li class="subpackage">file<ul><li class="class"><a href="yFile.html">yFile</a></li></ul></li><li class="subpackage">log<ul><li class="class"><a href="yLogMessage.html">yLogMessage</a></li><li class="class"><a href="yLogRoute.html">yLogRoute</a></li><li class="class"><a href="yLogger.html">yLogger</a></li><li class="class"><a href="yStderrLogRoute.html">yStderrLogRoute</a></li><li class="class"><a href="yStdoutLogRoute.html">yStdoutLogRoute</a></li><li class="class"><a href="yStreamLogRoute.html">yStreamLogRoute</a></li></ul></li><li class="subpackage">profiler<ul><li class="class"><a href="yProfiler.html">yProfiler</a></li></ul></li><li class="subpackage">uri<ul><li class="class"><a href="yUri.html">yUri</a></li><li class="class"><a href="yUriAuthority.html">yUriAuthority</a></li><li class="class"><a href="yUriFragment.html">yUriFragment</a></li><li class="class"><a href="yUriPath.html">yUriPath</a></li><li class="class"><a href="yUriQuery.html">yUriQuery</a></li><li class="class"><a href="yUriScheme.html">yUriScheme</a></li></ul></li></ul></li></ul></div>            
</td><td valign="top">
            
<h1>yLogger</h1>
<div><b>@package</b> yuki</div>
<div><b>@subpackage</b> log</div>

<!-- Hierarhy -->

<h2>Introduction</h2>
yLogger records log messages in memory.<br />
<br />


<h2>Method Summary</h2>
<div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">static <a href="#method.getInstance">getInstance</a>(<span class="param"></span>);</div><div style="font-size: 11px; margin-top: 1em;"></div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">yLogger
 <a href="#method.setLogLevel">setLogLevel</a>(<span class="param">$level</span>);</div><div style="font-size: 11px; margin-top: 1em;">Sets log level.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">int
 <a href="#method.getLogLevel">getLogLevel</a>(<span class="param"></span>);</div><div style="font-size: 11px; margin-top: 1em;">Gets current log level</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method">yLogger
 <a href="#method.log">log</a>(<span class="param">$message, $priority = "info"</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs a message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.flush">flush</a>(<span class="param"></span>);</div><div style="font-size: 11px; margin-top: 1em;">Removes all recorded messages from the memory.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.emerg">emerg</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs an emerg message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.alert">alert</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs an alert message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.crit">crit</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs a critical message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.error">error</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs an error message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.warning">warning</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs a warning message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.notice">notice</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs a notice message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.info">info</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs a info message.</div></div><div class="summary" style="padding-bottom: 5px;margin-bottom: 5px;border-bottom: 1px solid #AAA;"><div class="method"><a href="#method.debug">debug</a>(<span class="param">$message</span>);</div><div style="font-size: 11px; margin-top: 1em;">Logs a debug message.</div></div>
<h2>Method Details</h2>
<div style="padding: 4px;border: solid 1px #666;"><a name="method.__construct"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">protected <a href="#method.__construct">__construct</a>(<span class="param"></span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    protected function __construct(){
        // make it low-cost to transfer between methods
        $this-&gt;_logs = new ArrayObject();
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.getInstance"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">static <a href="#method.getInstance">getInstance</a>(<span class="param"></span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3></h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public static function getInstance(){
        if (self::$_instance === null){
            // Create a new instance
            Log::$_instance = new Log;
            // Flush the logs at shutdown
            register_shutdown_function(array(self::$_instance, 'flush'));
        }
        return self::$_instance;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.setLogLevel"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">yLogger
 <a href="#method.setLogLevel">setLogLevel</a>(<span class="param">$level</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$level
</b> (int) </div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Sets log level.
</h3></div></div><div><b>returns</b> yLogger
 </div></div></div><h3>Source Code</h3><pre class="brush: php">    public function setLogLevel($level){
        $this-&gt;_level = $level;
        return $this;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.getLogLevel"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">int
 <a href="#method.getLogLevel">getLogLevel</a>(<span class="param"></span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Gets current log level
</h3></div></div><div><b>returns</b> int
 </div></div></div><h3>Source Code</h3><pre class="brush: php">    public function getLogLevel(){
        return $this-&gt;_level;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.log"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method">yLogger
 <a href="#method.log">log</a>(<span class="param">$message, $priority = "info"</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div><b style="color: #683B00;">$priority</b> (int) Message priority
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs a message.
</h3></div></div><div><b>returns</b> yLogger
 </div></div></div><h3>Source Code</h3><pre class="brush: php">    public function log($message, $priority = self::INFO){
        if ($priority &gt; $this-&gt;_level){
            return false;
        }
        $this-&gt;_logCount++;
        $this-&gt;_logs[$this-&gt;_logCount] = new yLogMessage($message, $priority);
        if ($this-&gt;_autoFlush &gt; 0 &amp;&amp; $this-&gt;_logCount &gt;= $this-&gt;_autoFlush){
            $this-&gt;flush();
        }
        return $this;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.flush"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.flush">flush</a>(<span class="param"></span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Removes all recorded messages from the memory.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function flush(){
        // @todo Notify log writers

        $this-&gt;_logs = new ArrayObject();
        $this-&gt;_logCount = 0;
        return $this;
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.emerg"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.emerg">emerg</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (tystringpe) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs an emerg message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function emerg($message){
        $this-&gt;log($message, self::EMERG);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.alert"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.alert">alert</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs an alert message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function alert($message){
        $this-&gt;log($message, self::ALERT);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.crit"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.crit">crit</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs a critical message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function crit($message){
        $this-&gt;log($message, self::CRIT);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.error"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.error">error</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs an error message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function error($message){
        $this-&gt;log($message, self::ERROR);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.warning"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.warning">warning</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs a warning message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function warning($message){
        $this-&gt;log($message, self::WARNING);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.notice"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.notice">notice</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs a notice message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function notice($message){
        $this-&gt;log($message, self::NOTICE);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.info"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.info">info</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs a info message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function info($message){
        $this-&gt;log($message, self::INFO);
    }
</pre></div><div style="padding: 4px;border: solid 1px #666;"><a name="method.debug"></a><div style="font-size: 11px;"><div class="classsynopsis"><div class="method"><a href="#method.debug">debug</a>(<span class="param">$message</span>);</div></div><div style="padding: 7px; margin-bottom: 2em; border: dashed 1px #eee; margin-tOP; 1em;"><div><b style="color: #683B00;">$message</b> (string) Message
</div><div style="margin-top: 1em; margin-bottom: 1em;"><div><h3>Logs a debug message.
</h3></div></div></div></div><h3>Source Code</h3><pre class="brush: php">    public function debug($message){
        $this-&gt;log($message, self::DEBUG);
    }
</pre></div>


<h2>Class synopsis</h2>
<div class="classsynopsis">
<b class="classname">yLogger</b> {
<div class="contents">
<h3>/* Properties */</h3>
<div class="property">protected <a href="#property._level">$_level</a>;</div><div class="property">protected <a href="#property._autoFlush">$_autoFlush</a>;</div><div class="property">protected <a href="#property._logs">$_logs</a>;</div><div class="property">protected <a href="#property._logCount">$_logCount</a>;</div><div class="property">protected <a href="#property._instance">$_instance</a>;</div>
<h3>/* Methods */</h3>
<div class="method">protected <a href="#method.__construct">__construct</a>(<span class="param"></span>);</div><div class="method">static <a href="#method.getInstance">getInstance</a>(<span class="param"></span>);</div><div class="method">yLogger
 <a href="#method.setLogLevel">setLogLevel</a>(<span class="param">$level</span>);</div><div class="method">int
 <a href="#method.getLogLevel">getLogLevel</a>(<span class="param"></span>);</div><div class="method">yLogger
 <a href="#method.log">log</a>(<span class="param">$message, $priority = "info"</span>);</div><div class="method"><a href="#method.flush">flush</a>(<span class="param"></span>);</div><div class="method"><a href="#method.emerg">emerg</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.alert">alert</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.crit">crit</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.error">error</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.warning">warning</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.notice">notice</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.info">info</a>(<span class="param">$message</span>);</div><div class="method"><a href="#method.debug">debug</a>(<span class="param">$message</span>);</div>
</div>
}
</div>


</td></tr></table>
</body>
</html>